package com.boang.resp;

/**
 * http 状态码
 */
public enum BaseErrorCode {

    // 200开头，成功，表明服务器成功地接受了客户端请求
    SUCCESS(200, "成功"),
    QUERY_SUCCESS(201, "查询成功"),
    SAVE_SUCCESS(202, "保存成功"),
    IMPORT_SUCCESS(203, "导入成功"),
    UPLOAD_SUCCESS(204, "上传成功"),
    EXPORT_SUCCESS(205, "导出成功"),

    // 300开头，重定向，客户端浏览器必须采取更多操作来实现请求
    TYPE_ERROR(400, "Type类型错误"),

    // 400开头，请求错误（客户端）
    PARAM_ERROR(400, "参数错误或短信校验未通过"),
    PARAM_ERROR_NO_REQUEST_ID(500, "参数错误"),
    AUTH_ERROR(401, "手机号认证错误"),
    AUTH_FORBIDDEN(403, "用户认证错误"),
    NOT_FOUND(404, "请求资源不存在"),
    TIMEOUT_ERROR(408, "超时错误"),
    NOT_READABLE(409, "请求格式错误"),
    MISS_PARAM(410, "缺少参数"),
    JSON_ERROR(411, "JSON解析错误"),

    // 500开头，服务器错误
    INTERNAL_ERROR(500, "系统内部错误"),
    SYSTEM_LOCK_ERROR(502, "系统繁忙，请稍后再试"),
    DUP_UPD_ERROR(504, "重复，更新数据失败！"),
    NULL_ERROR(505, "空指针异常"),
    NO_GOODS(506, "商品不存在"),
    NO_GOODS_SKU(507, "商品规格不存在"),
    COMLETE_USER_INFO(510, "用户信息未完善"),
    NOT_PASS(511, "评论未通过审核"),
    ORDER_STATUS_CANCELED(512, "当前订单已取消"),
    ORDER_STATUS_CHANGED(513, "当前订单状态已变更，请重新刷新"),
    CANCEL_ORDER_REPEAT(514, "取消订单重复"),
    LOCK_PRODUCT_SKU_STOCK_ERROR(515, "商品没有库存了"),
    AFTER_SALE_NOT_PASS(516, "售后未通过审核"),
    NO_ENOUGH_BALANCE(517, "积分余额不足"),
    AFTER_SALE_CANNOT_REVOKE(518, "当前订单状态不能同意申请"),
    NO_ORDER_LOGISTIC(533, "未查询到订单物流"),
    TOP_STATUS(535, "当前该商品已有置顶，请撤销原置顶在进行置顶操作"),
    CATEGORY_STATUS(536, "该二级类目已存在，请重新输入"),
    NOT_ENOUGH_BALANCE_EMPTY(537, "积分不能为零"),
    ;

    /**
     * 错误码
     */
    private final Integer code;
    /**
     * 错误信息
     */
    private final String msg;

    BaseErrorCode(Integer errorCode, String errorMsg) {
        this.code = errorCode;
        this.msg = errorMsg;
    }

    public Integer getCode() {
        return this.code;
    }

    public String getMsgOri() {
        return this.msg;
    }
}
